/**
 * User.java
 *
 * @author: ZhuJiahui
 * @date: 2018/8/26 15:28
 */
package com.zhujiahui.pattern.design.observer;

/**
 * @description: 观察者实现类
 * @author: ZhuJiahui
 * @version: 1.0
 */
public class User implements Observer {

    private String name;

    private String message;

    public User(String name) {
        this.name = name;
    }

    /**
     * 更新状态
     *
     * @param message 消息
     */
    @Override
    public void update(String message) {
        this.message = message;
        this.read();
    }

    private void read() {
        System.out.println(name + " 收到推送消息： " + message);
    }
}
